/*
 * Copyright (c) 2024 Black Sesame Technologies
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gtest/gtest.h>
#include "dal_cyclonedds/converter/QosConverter.hpp"

TEST(ConvertParticipantQosFromDalToCyclonedds_default, QosConverter)
{
    dal_ret_t ret;
    dds_qos_t *c_qos = dds_create_qos();
    ret = QosConverter::GetInstance()->ConvertParticipantQosFromDalToCyclonedds(
        DAL_PARTICIPANT_QOS_DEFAULT, c_qos);
    EXPECT_EQ(ret, DAL_RETCODE_OK);

    dds_qos_t *default_qos = dds_create_qos();
    int result = memcmp(c_qos, default_qos, sizeof(dds_qos_t));
    EXPECT_EQ(result, 0);
    dds_delete_qos(c_qos);
    dds_delete_qos(default_qos);
}

TEST(ConvertPublisherQosFromDalToCyclonedds_default, QosConverter)
{
    dal_ret_t ret;
    dds_qos_t *c_qos = dds_create_qos();
    ret = QosConverter::GetInstance()->ConvertPublisherQosFromDalToCyclonedds(
        DAL_PUBLISHER_QOS_DEFAULT, c_qos);
    EXPECT_EQ(ret, DAL_RETCODE_OK);

    dds_delete_qos(c_qos);
}

TEST(ConvertSubscriberQosFromDalToCyclonedds_default, QosConverter)
{
    dal_ret_t ret;
    dds_qos_t *c_qos = dds_create_qos();
    ret = QosConverter::GetInstance()->ConvertSubscriberQosFromDalToCyclonedds(
        DAL_SUBSCRIBER_QOS_DEFAULT, c_qos);
    EXPECT_EQ(ret, DAL_RETCODE_OK);
    dds_delete_qos(c_qos);
}

TEST(ConvertTopicQosFromDalToCyclonedds_default, QosConverter)
{
    dal_ret_t ret;
    dds_qos_t *c_qos = dds_create_qos();
    ret =
        QosConverter::GetInstance()->ConvertTopicQosFromDalToCyclonedds(DAL_TOPIC_QOS_DEFAULT, c_qos);
    EXPECT_EQ(ret, DAL_RETCODE_OK);

    dds_delete_qos(c_qos);
}

TEST(ConvertDataWriterQosFromDalToCyclonedds_default, QosConverter)
{
    dal_ret_t ret;
    dds_qos_t *c_qos = dds_create_qos();

    ret = QosConverter::GetInstance()->ConvertDataWriterQosFromDalToCyclonedds(
        DAL_DATAWRITER_QOS_DEFAULT, c_qos);
    EXPECT_EQ(ret, DAL_RETCODE_OK);

    dds_delete_qos(c_qos);
}

TEST(ConvertDataReaderQosFromDalToCyclonedds_default, QosConverter)
{
    dal_ret_t ret;
    dds_qos_t *c_qos = dds_create_qos();

    ret = QosConverter::GetInstance()->ConvertDataReaderQosFromDalToCyclonedds(
        DAL_DATAREADER_QOS_DEFAULT, c_qos);
    EXPECT_EQ(ret, DAL_RETCODE_OK);

    dds_delete_qos(c_qos);
}

TEST(ConvertParticipantQosFromDalToCyclonedds, QosConverter)
{
    dal_ret_t ret;
    dal_domain_participant_qos_t d_qos = { };
    dds_qos_t *c_qos = dds_create_qos();

    INIT_SEQUENCE(octet, &d_qos.user_data.value);
    PUSH_BACK_SEQUENCE(octet, &d_qos.user_data.value, 11);
    PUSH_BACK_SEQUENCE(octet, &d_qos.user_data.value, 22);

    d_qos.entity_factory.autoenable_created_entities = DAL_TRUE;
    d_qos.participant_name = "DefinedParticipant";
    d_qos.localhost_only = DAL_TRUE;

    ret = QosConverter::GetInstance()->ConvertParticipantQosFromDalToCyclonedds(&d_qos, c_qos);

    EXPECT_EQ(ret, DAL_RETCODE_OK);
    uint8_t d_value[2] = {11, 22};
    int result = memcmp(c_qos->user_data.value, (uint8_t *)d_value, c_qos->user_data.length);
    EXPECT_EQ(result, 0);
    EXPECT_EQ(c_qos->entity_factory.autoenable_created_entities, DAL_TRUE);

    EXPECT_STREQ(c_qos->entity_name, "DefinedParticipant");

    dds_delete_qos(c_qos);
}

TEST(ConvertPublisherQosFromDalToCyclonedds, QosConverter)
{
    dal_ret_t ret;
    dal_publisher_qos_t *d_qos = dal_create_default_publisher_qos();
    dds_qos_t *c_qos = dds_create_qos();

    d_qos->presentation.access_scope = DAL_TOPIC_PRESENTATION_QOS;
    d_qos->presentation.coherent_access = DAL_TRUE;
    d_qos->presentation.ordered_access = DAL_TRUE;

    const char* c_partitions[] = {"Partition1", "Partition2"};
    d_qos->partition.name = {2, (char**)c_partitions};

    INIT_SEQUENCE(octet, &d_qos->group_data.value);
    PUSH_BACK_SEQUENCE(octet, &d_qos->group_data.value, 11);
    PUSH_BACK_SEQUENCE(octet, &d_qos->group_data.value, 22);
    d_qos->entity_factory.autoenable_created_entities = DAL_TRUE;

    ret = QosConverter::GetInstance()->ConvertPublisherQosFromDalToCyclonedds(d_qos, c_qos);

    EXPECT_EQ(ret, DAL_RETCODE_OK);
    EXPECT_EQ(c_qos->presentation.access_scope, DDS_PRESENTATION_TOPIC);
    EXPECT_EQ(c_qos->presentation.coherent_access, DAL_TRUE);
    EXPECT_EQ(c_qos->presentation.ordered_access, DAL_TRUE);

    uint8_t d_value[2] = {11, 22};
    int result = memcmp(c_qos->group_data.value, (uint8_t *)d_value, c_qos->group_data.length);
    EXPECT_EQ(result, 0);

    dal_stringseq_t d_str_seq_get;
    dds_qget_partition(c_qos, &d_str_seq_get.n, &d_str_seq_get.strs);
    EXPECT_EQ(0, strcmp(c_partitions[0], d_str_seq_get.strs[0]));
    EXPECT_EQ(0, strcmp(c_partitions[1], d_str_seq_get.strs[1]));

    EXPECT_EQ(c_qos->entity_factory.autoenable_created_entities, DAL_TRUE);
    dds_delete_qos(c_qos);
    dal_delete_publisher_qos(d_qos);
}

TEST(ConvertSubscriberQosFromDalToCyclonedds, QosConverter)
{
    dal_ret_t ret;
    dal_subscriber_qos_t *d_qos = dal_create_default_subscriber_qos();

    dds_qos_t *c_qos = dds_create_qos();

    d_qos->presentation.access_scope = DAL_GROUP_PRESENTATION_QOS;
    d_qos->presentation.coherent_access = DAL_TRUE;
    d_qos->presentation.ordered_access = DAL_TRUE;

    const char* c_partitions[] = {"Partition1", "Partition2"};
    d_qos->partition.name = {2, (char**)c_partitions};

    INIT_SEQUENCE(octet, &d_qos->group_data.value);
    PUSH_BACK_SEQUENCE(octet, &d_qos->group_data.value, 11);
    PUSH_BACK_SEQUENCE(octet, &d_qos->group_data.value, 22);
    d_qos->entity_factory.autoenable_created_entities = DAL_TRUE;

    ret = QosConverter::GetInstance()->ConvertSubscriberQosFromDalToCyclonedds(d_qos, c_qos);

    EXPECT_EQ(ret, DAL_RETCODE_OK);
    EXPECT_EQ(c_qos->presentation.access_scope, DDS_PRESENTATION_GROUP);
    EXPECT_EQ(c_qos->presentation.coherent_access, DAL_TRUE);
    EXPECT_EQ(c_qos->presentation.ordered_access, DAL_TRUE);

    uint8_t d_value[2] = {11, 22};
    int result = memcmp(c_qos->group_data.value, (uint8_t *)d_value, c_qos->group_data.length);
    EXPECT_EQ(result, 0);

    dal_stringseq_t d_str_seq_get;
    dds_qget_partition(c_qos, &d_str_seq_get.n, &d_str_seq_get.strs);
    EXPECT_EQ(0, strcmp(c_partitions[0], d_str_seq_get.strs[0]));
    EXPECT_EQ(0, strcmp(c_partitions[1], d_str_seq_get.strs[1]));

    EXPECT_EQ(c_qos->entity_factory.autoenable_created_entities, DAL_TRUE);
    dds_delete_qos(c_qos);
    dal_delete_subscriber_qos(d_qos);
}

TEST(ConvertTopicQosFromDalToCyclonedds, QosConverter)
{
    dal_ret_t ret;
    dal_topic_qos_t d_qos;
    dds_qos_t *c_qos = dds_create_qos();

    INIT_SEQUENCE(octet, &d_qos.topic_data.value);
    PUSH_BACK_SEQUENCE(octet, &d_qos.topic_data.value, 11);
    PUSH_BACK_SEQUENCE(octet, &d_qos.topic_data.value, 22);
    d_qos.durability.kind = DAL_TRANSIENT_LOCAL_DURABILITY_QOS;
    d_qos.durability_service.service_cleanup_delay.sec = 111;
    d_qos.durability_service.service_cleanup_delay.nanosec = 222;
    d_qos.durability_service.history_kind = DAL_KEEP_ALL_HISTORY_QOS;
    d_qos.durability_service.history_depth = 111;
    d_qos.durability_service.max_samples = 222;
    d_qos.durability_service.max_instances = 333;
    d_qos.durability_service.max_samples_per_instance = 444;
    d_qos.deadline.period.sec = 555;
    d_qos.deadline.period.nanosec = 666;
    d_qos.latency_budget.duration.sec = 777;
    d_qos.latency_budget.duration.nanosec = 888;
    d_qos.liveliness.kind = DAL_MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
    d_qos.liveliness.lease_duration.sec = 111;
    d_qos.liveliness.lease_duration.nanosec = 222;
    d_qos.reliability.kind = DAL_RELIABLE_RELIABILITY_QOS;
    d_qos.reliability.max_blocking_time.sec = 333;
    d_qos.reliability.max_blocking_time.nanosec = 444;
    d_qos.destination_order.kind = DAL_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
    d_qos.history.kind = DAL_KEEP_ALL_HISTORY_QOS;
    d_qos.history.depth = 555;
    d_qos.resource_limits.max_samples = 666;
    d_qos.resource_limits.max_instances = 777;
    d_qos.resource_limits.max_samples_per_instance = 888;
    d_qos.transport_priority.value = 3;
    d_qos.lifespan.duration.sec = 111;
    d_qos.lifespan.duration.nanosec = 222;
    d_qos.ownership.kind = DAL_EXCLUSIVE_OWNERSHIP_QOS;

    ret = QosConverter::GetInstance()->ConvertTopicQosFromDalToCyclonedds(&d_qos, c_qos);

    EXPECT_EQ(ret, DAL_RETCODE_OK);

    uint8_t d_value[2] = {11, 22};
    int result = memcmp(c_qos->topic_data.value, (uint8_t *)d_value, c_qos->topic_data.length);
    EXPECT_EQ(result, 0);

    EXPECT_EQ(c_qos->durability.kind, DDS_DURABILITY_TRANSIENT_LOCAL);

    EXPECT_EQ(c_qos->durability_service.service_cleanup_delay / 1000000000, 111);
    EXPECT_EQ(c_qos->durability_service.service_cleanup_delay % 1000000000, 222);
    EXPECT_EQ(c_qos->durability_service.history.kind, DDS_HISTORY_KEEP_ALL);
    EXPECT_EQ(c_qos->durability_service.history.depth, 111);
    EXPECT_EQ(c_qos->durability_service.resource_limits.max_samples, 222);
    EXPECT_EQ(c_qos->durability_service.resource_limits.max_instances, 333);
    EXPECT_EQ(c_qos->durability_service.resource_limits.max_samples_per_instance, 444);

    EXPECT_EQ(c_qos->deadline.deadline / 1000000000, 555);
    EXPECT_EQ(c_qos->deadline.deadline % 1000000000, 666);

    EXPECT_EQ(c_qos->latency_budget.duration / 1000000000, 777);
    EXPECT_EQ(c_qos->latency_budget.duration % 1000000000, 888);

    EXPECT_EQ(c_qos->liveliness.kind, DDS_LIVELINESS_MANUAL_BY_PARTICIPANT);
    EXPECT_EQ(c_qos->liveliness.lease_duration / 1000000000, 111);
    EXPECT_EQ(c_qos->liveliness.lease_duration % 1000000000, 222);

    EXPECT_EQ(c_qos->reliability.kind, DDS_RELIABILITY_RELIABLE);
    EXPECT_EQ(c_qos->reliability.max_blocking_time / 1000000000, 333);
    EXPECT_EQ(c_qos->reliability.max_blocking_time % 1000000000, 444);

    EXPECT_EQ(c_qos->destination_order.kind, DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP);

    EXPECT_EQ(c_qos->history.kind, DDS_HISTORY_KEEP_ALL);
    EXPECT_EQ(c_qos->history.depth, 555);

    EXPECT_EQ(c_qos->resource_limits.max_samples, 666);
    EXPECT_EQ(c_qos->resource_limits.max_instances, 777);
    EXPECT_EQ(c_qos->resource_limits.max_samples_per_instance, 888);

    EXPECT_EQ(c_qos->transport_priority.value, 3);

    EXPECT_EQ(c_qos->lifespan.duration / 1000000000, 111);
    EXPECT_EQ(c_qos->lifespan.duration % 1000000000, 222);

    EXPECT_EQ(c_qos->ownership.kind, DDS_OWNERSHIP_EXCLUSIVE);
    dds_delete_qos(c_qos);
}

TEST(ConvertDataWriterQosFromDalToCyclonedds, QosConverter)
{
    dal_ret_t ret;
    dal_datawriter_qos_t d_qos;
    dds_qos_t *c_qos = dds_create_qos();

    d_qos.durability.kind = DAL_VOLATILE_DURABILITY_QOS;
    d_qos.durability_service.service_cleanup_delay.sec = 111;
    d_qos.durability_service.service_cleanup_delay.nanosec = 222;
    d_qos.durability_service.history_kind = DAL_KEEP_ALL_HISTORY_QOS;
    d_qos.durability_service.history_depth = 111;
    d_qos.durability_service.max_samples = 222;
    d_qos.durability_service.max_instances = 333;
    d_qos.durability_service.max_samples_per_instance = 444;
    d_qos.deadline.period.sec = 555;
    d_qos.deadline.period.nanosec = 666;
    d_qos.latency_budget.duration.sec = 777;
    d_qos.latency_budget.duration.nanosec = 888;
    d_qos.liveliness.kind = DAL_MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
    d_qos.liveliness.lease_duration.sec = 111;
    d_qos.liveliness.lease_duration.nanosec = 222;
    d_qos.reliability.kind = DAL_RELIABLE_RELIABILITY_QOS;
    d_qos.reliability.max_blocking_time.sec = 333;
    d_qos.reliability.max_blocking_time.nanosec = 444;
    d_qos.destination_order.kind = DAL_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
    d_qos.history.kind = DAL_KEEP_ALL_HISTORY_QOS;
    d_qos.history.depth = 555;
    d_qos.resource_limits.max_samples = 666;
    d_qos.resource_limits.max_instances = 777;
    d_qos.resource_limits.max_samples_per_instance = 888;
    d_qos.transport_priority.value = 3;
    d_qos.lifespan.duration.sec = 111;
    d_qos.lifespan.duration.nanosec = 222;
    INIT_SEQUENCE(octet, &d_qos.user_data.value);
    PUSH_BACK_SEQUENCE(octet, &d_qos.user_data.value, 11);
    PUSH_BACK_SEQUENCE(octet, &d_qos.user_data.value, 22);
    d_qos.ownership.kind = DAL_EXCLUSIVE_OWNERSHIP_QOS;
    d_qos.ownership_strength.value = 4;
    d_qos.writer_data_lifecycle.autodispose_unregistered_instances = 5;

    ret = QosConverter::GetInstance()->ConvertDataWriterQosFromDalToCyclonedds(&d_qos, c_qos);
    EXPECT_EQ(ret, DAL_RETCODE_OK);

    EXPECT_EQ(c_qos->durability.kind, DDS_DURABILITY_VOLATILE);

    // value defined by durability and history qos in cyclonedds.
    EXPECT_EQ(c_qos->durability_service.service_cleanup_delay / 1000000000, 111);
    EXPECT_EQ(c_qos->durability_service.service_cleanup_delay % 1000000000, 222);
    EXPECT_EQ(c_qos->durability_service.history.kind, DDS_HISTORY_KEEP_ALL);
    EXPECT_EQ(c_qos->durability_service.history.depth, 111);
    EXPECT_EQ(c_qos->durability_service.resource_limits.max_samples, 222);
    EXPECT_EQ(c_qos->durability_service.resource_limits.max_instances, 333);
    EXPECT_EQ(c_qos->durability_service.resource_limits.max_samples_per_instance, 444);

    EXPECT_EQ(c_qos->deadline.deadline, uint64_t(555) * 1000000000 + 666);

    EXPECT_EQ(c_qos->latency_budget.duration, uint64_t(777) * 1000000000 + 888);

    EXPECT_EQ(c_qos->liveliness.kind, DDS_LIVELINESS_MANUAL_BY_PARTICIPANT);
    EXPECT_EQ(c_qos->liveliness.lease_duration, uint64_t(111) * 1000000000 + 222);

    EXPECT_EQ(c_qos->reliability.kind, DDS_RELIABILITY_RELIABLE);
    EXPECT_EQ(c_qos->reliability.max_blocking_time, uint64_t(333) * 1000000000 + 444);

    EXPECT_EQ(c_qos->destination_order.kind, DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP);

    EXPECT_EQ(c_qos->history.kind, DDS_HISTORY_KEEP_ALL);
    EXPECT_EQ(c_qos->history.depth, 555);

    EXPECT_EQ(c_qos->resource_limits.max_samples, 666);
    EXPECT_EQ(c_qos->resource_limits.max_instances, 777);
    EXPECT_EQ(c_qos->resource_limits.max_samples_per_instance, 888);

    EXPECT_EQ(c_qos->transport_priority.value, 3);

    EXPECT_EQ(c_qos->lifespan.duration, uint64_t(111) * 1000000000 + 222);

    uint8_t d_value[2] = {11, 22};
    int result = memcmp(c_qos->user_data.value, (uint8_t *)d_value, c_qos->user_data.length);
    EXPECT_EQ(result, 0);

    EXPECT_EQ(c_qos->ownership.kind, DDS_OWNERSHIP_EXCLUSIVE);
    EXPECT_EQ(c_qos->ownership_strength.value, 4);

    EXPECT_EQ(c_qos->writer_data_lifecycle.autodispose_unregistered_instances, 5);
    dds_delete_qos(c_qos);
}

TEST(ConvertDataReaderQosFromDalToCyclonedds, QosConverter)
{
    dal_ret_t ret;
    dal_datareader_qos_t d_qos;
    dds_qos_t *c_qos = dds_create_qos();

    d_qos.durability.kind = DAL_TRANSIENT_LOCAL_DURABILITY_QOS;
    d_qos.deadline.period.sec = 555;
    d_qos.deadline.period.nanosec = 666;
    d_qos.latency_budget.duration.sec = 777;
    d_qos.latency_budget.duration.nanosec = 888;
    d_qos.liveliness.kind = DAL_MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
    d_qos.liveliness.lease_duration.sec = 111;
    d_qos.liveliness.lease_duration.nanosec = 222;
    d_qos.reliability.kind = DAL_RELIABLE_RELIABILITY_QOS;
    d_qos.reliability.max_blocking_time.sec = 333;
    d_qos.reliability.max_blocking_time.nanosec = 444;
    d_qos.destination_order.kind = DAL_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
    d_qos.history.kind = DAL_KEEP_ALL_HISTORY_QOS;
    d_qos.history.depth = 555;
    d_qos.resource_limits.max_samples = 666;
    d_qos.resource_limits.max_instances = 777;
    d_qos.resource_limits.max_samples_per_instance = 888;
    INIT_SEQUENCE(octet, &d_qos.user_data.value);
    PUSH_BACK_SEQUENCE(octet, &d_qos.user_data.value, 11);
    PUSH_BACK_SEQUENCE(octet, &d_qos.user_data.value, 22);
    d_qos.ownership.kind = DAL_EXCLUSIVE_OWNERSHIP_QOS;
    d_qos.time_based_filter.minimum_separation.sec = 11;
    d_qos.time_based_filter.minimum_separation.nanosec = 22;
    d_qos.reader_data_lifecycle.autopurge_nowriter_samples_delay.sec = 33;
    d_qos.reader_data_lifecycle.autopurge_nowriter_samples_delay.nanosec = 44;
    d_qos.reader_data_lifecycle.autopurge_disposed_samples_delay.sec = 55;
    d_qos.reader_data_lifecycle.autopurge_disposed_samples_delay.nanosec = 66;

    ret = QosConverter::GetInstance()->ConvertDataReaderQosFromDalToCyclonedds(&d_qos, c_qos);
    EXPECT_EQ(ret, DAL_RETCODE_OK);

    EXPECT_EQ(c_qos->durability.kind, DDS_DURABILITY_TRANSIENT_LOCAL);

    EXPECT_EQ(c_qos->deadline.deadline, uint64_t(555) * 1000000000 + 666);

    EXPECT_EQ(c_qos->latency_budget.duration, uint64_t(777) * 1000000000 + 888);

    EXPECT_EQ(c_qos->liveliness.kind, DDS_LIVELINESS_MANUAL_BY_PARTICIPANT);
    EXPECT_EQ(c_qos->liveliness.lease_duration, uint64_t(111) * 1000000000 + 222);

    EXPECT_EQ(c_qos->reliability.kind, DDS_RELIABILITY_RELIABLE);
    EXPECT_EQ(c_qos->reliability.max_blocking_time, uint64_t(333) * 1000000000 + 444);

    EXPECT_EQ(c_qos->destination_order.kind, DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP);

    EXPECT_EQ(c_qos->history.kind, DDS_HISTORY_KEEP_ALL);
    EXPECT_EQ(c_qos->history.depth, 555);

    EXPECT_EQ(c_qos->resource_limits.max_samples, 666);
    EXPECT_EQ(c_qos->resource_limits.max_instances, 777);
    EXPECT_EQ(c_qos->resource_limits.max_samples_per_instance, 888);

    uint8_t d_value[2] = {11, 22};
    int result = memcmp(c_qos->user_data.value, (uint8_t *)d_value, c_qos->user_data.length);
    EXPECT_EQ(result, 0);

    EXPECT_EQ(c_qos->ownership.kind, DDS_OWNERSHIP_EXCLUSIVE);

    EXPECT_EQ(c_qos->time_based_filter.minimum_separation, uint64_t(11) * 1000000000 + 22);

    EXPECT_EQ(c_qos->reader_data_lifecycle.autopurge_nowriter_samples_delay, uint64_t(33) * 1000000000 + 44);
    EXPECT_EQ(c_qos->reader_data_lifecycle.autopurge_disposed_samples_delay, uint64_t(55) * 1000000000 + 66);
    dds_delete_qos(c_qos);
}

TEST(ConvertPartitionQos, QosConverter)
{
    int i;
    const char* c_partitions[] = {"Partition1", "Partition2"};
    dal_stringseq_t d_str_seq = {2, (char**)c_partitions};
    dds_qos_t *c_qos = dds_create_qos();
    dds_qset_partition(c_qos, d_str_seq.n, (const char**)d_str_seq.strs);

    dal_stringseq_t d_str_seq_get;
    dds_qget_partition(c_qos, &d_str_seq_get.n, &d_str_seq_get.strs);

    EXPECT_EQ(0, strcmp(c_partitions[0], d_str_seq_get.strs[0]));
    EXPECT_EQ(0, strcmp(c_partitions[1], d_str_seq_get.strs[1]));

    dds_delete_qos(c_qos);
}